import {defineStore} from 'pinia'
import axios from 'axios'
import {ref} from 'vue'

export const useVarChooseStore = defineStore('varChoose', () =>{

    const jsonMsg = ref<any>();

    const getJsonMsgArr = ref<any>();

    //获取后端的jsonMsg数据
    async function getJsonMsg() {
    try {
        let result = await axios.get('http://localhost:3000/api/data')
        console.log("http.result 111111111", result.data.data.msga)
        jsonMsg.value = result.data.data.msga[0]
        getJsonMsgArr.value = result.data.data.msga
    } catch (error) {
        alert(error)
    }
}

return {jsonMsg,getJsonMsgArr, getJsonMsg}

})